<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="org.edu.system.DBConnect" %>
<!DOCTYPE html>
<html>
<head>
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<% 
try{
String id = request.getParameter("id");//获取上个页面传来的id 
//out.println(id);
String sql_select = "SELECT * FROM lesson WHERE lesson_id = '" + id + "'";
Connection con = DBConnect.getCon();
request.setCharacterEncoding("utf-8");
System.out.println(sql_select);

PreparedStatement pst = con.prepareStatement(sql_select);
ResultSet rs = pst.executeQuery();
System.out.println(pst);
System.out.println(rs);
if(rs.next()){
	//out.println(id);

%>
<form action="sk_update_servelt?dataBase=edu_system&tableName=lesson" >
			<table align="center" border="1" width="100%" class="table table-striped table-bordered">  
     <tr>
         <th colspan="2" style="text-align:center" >更改信息</th><%--th加粗， cellpadding和android padding含义一样--%>
    </tr>
    <tr>
        <td align="right" width="50%">* 授课ID：</td>   
        <td align="left" ><input type="text" name="ID" value="<%=rs.getString("lesson_id") %>"></td>
    </tr>
    <tr>
        <td align="right" >教师工号：</td> 
         <td align="left" ><input type="text" name="tID" value="<%=rs.getString("tc_id") %>"></td>
     </tr>
    <tr>
        <td align="right" >课程ID：</td>
         <td align="left" ><input type="text" name="cID" value="<%=rs.getString("course_id") %>"></td>
   </tr>
       <tr>
        <td align="right" >授课时间：</td>
        <td align="left" ><input type="text" name="time" value="<%=rs.getString("time") %>"></td>
     </tr>
     	<tr>
        <td align="right" >授课星期：</td>
        <td align="left" ><input type="text" name="week" value="<%=rs.getString("week") %>"></td>
     </tr>
     	</tr>
     	<tr>
        <td align="right" >授课班级：</td>
        <td align="left" ><input type="text" name="class" value="<%=rs.getString("class") %>"></td>
     </tr>
        <tr>
        <td align="right" >授课地点：</td>
        <td align="left" ><input type="text" name="local" value="<%=rs.getString("location") %>"></td>
    </tr>
   
    <tr>
        <th colspan="2" style="text-align:center" ><input type="submit" class="btn btn-primary btn-sm" name="submit" value="更新"></th>
     </tr> 
 </table>		
		</form>
	</div>

<%
}
//out.println(id);
} catch (Exception e) {
	out.println(e);
}
%>
</body>
</html>